from django.utils.deprecation import MiddlewareMixin
# MiddlewareMixin
class TestMiddleare(MiddlewareMixin):

    # 每次请求前 都会调用
    def process_request(self,request):
        print('request 每次请求前 都会调用')
        pass

    #在每次响应前 都会调用
    def process_response(self,request,response):

        print('response 每次响应前 都会调用')
        # 记得 响应要返回
        return response